#!/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
# -*- coding: UTF-8 -*-

words =['heelo','good','apple','world','wwww','digit','world']
w=input('请输入一个单词')

# for word in words :
#     if w in word:
#         del w
#         break
# print(words)

# 删掉一个以后指针回退一下再增加
# i=0
# l=len(words)
# while i<l:
#     if w in words[i]:
#         del words[i]
#         l-=1
#         i-=1  # continue也可以
#     i+=1
# print(words)        

# 如果删掉一个后，指针就不增加
i=0
l=len(words)
while i<l:
    if w in words[i]:
        del words[i]
        l-=1
    else   : 
        i+=1
print(words)        
